import { ElLoading, ElMessage } from 'element-plus'
let loading: any = null;

export const ShowLoading = (msg = "加载中") => {
    ElMessage.closeAll()
    loading && loading.close()
    loading = ElLoading.service({
        lock: true,
        text: msg,
        background: 'rgba(0,0,0,0.7)'
    })
}

export const ShowSuccess = (msg = "成功") => {
    loading && loading.close()
    ElMessage.closeAll()
    ElMessage({
        message: msg,
        type: 'success'
    })
}

export const ShowError = (msg = "失败") => {
    loading && loading.close()
    ElMessage.closeAll()
    ElMessage({
        message: msg,
        type: 'error',
    })
}